<template>
  <div class="gl-no-data">
    <img src="@/assets/img/no-data.png" alt="" />
    <div class="msg">{{ msg }}</div>
  </div>
</template>
<script setup >
import { ref } from 'vue'
import { useRoute, useRouter } from 'vue-router';
const route = useRoute();
const router = useRouter();
const props = defineProps({
  msg: {
    type: String,
    default: '暂无数据',
  },
})
let redirectPath = route.query.redirect;
let redirectWord = '';
if (redirectPath == '/error404') {
  redirectWord = '，即将返回主页';
  redirectPath = '/';
} else if (redirectPath) {
  redirectWord = '，即将返回上一页';
}
let msg = ref('')
msg.value = (route.query.error || props.msg) + redirectWord;
setTimeout(() => {
  if (redirectPath) {
    router.replace(redirectPath)
  }
}, 3000);

</script>
<style lang="scss">
.gl-no-data {
  width: 100%;
  text-align: center;

  img {
    width: 350px;
  }

  .msg {
    padding: 0px 44px;
    font-size: 16px;
    line-height: 32px;
    color: #374756;
  }
}
</style>

